package com.tmjx.controller;

import com.tmjx.entitys.User;
import com.tmjx.resp.VfResult;
import com.tmjx.service.UserService;
import com.tmjx.web.IUserWeb;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 33117
 * @version 1.0
 * @data 2025/8/20 10:53
 */
@Component
public class UserController implements IUserWeb {

    @Resource
    private UserService userService;
    @Resource
    @Qualifier("customThreadPool")
    private ThreadPoolTaskExecutor taskExecutor;

    @Override
    public VfResult list() {
        // 线程池
        taskExecutor.execute(() -> {
            System.out.println(Thread.currentThread().getName());
        });
        List<User> list = userService.list();
        return VfResult.ok(list);
    }
}
